category: HOW TO
In this short but concise post, I will show you exactly how to kill stuck or unused nodejs processes that eats up the limit of processes allocated to your hosting account in c-panel. Your website will eventually crash when the limit of processes your hosting plan allows is exceeded.
C-Panel is a popular web hosting panel that allows website owners and hosting providers to manage web hosing accounts, domains, email accounts and other web hosting related services.
When you login to your C-Panel, you will notice "entry processes", "number of processes", and "physical memory usage" on the sidebar (if you are on a desktop device).
The entry processes are the number of connections your account can process simultaneously and it usually will have a limit based on your hosting plan.
The number of simultaneous processes/connections is not the same as the number of visitors you can have on your website at one time. Processes/connections are only counted while they process and once the process is complete it is no longer counted as an active process. For example, if your website has a visitor and it takes 1000 milliseconds to load while generating a single http connection, that visitor will count as a single process. Although they will continue to view your website, they will no longer be counted as a process until they do something else to create a new process such as opening a new page.
If your nodejs app is not adequately optimized, these process will get stuck even though they are not in use and as a result , the number of processes in your C-Panel account will continuously be on the increase and this will impact your physical memory usage(RAM). The moment your number of processes exceeds the limit allowed by your hosting plan, your website will CRASH!!
On your C-panel account, navigate into "advanced" and select "CRON JOBS". Create a new CRON JOB (Please ask your hosting provider for guidance if you don't know how to) and type the below command in the command space provided.
/usr/bin/pkill -9 Isnode
This command will kill all processes that are stuck or unused each time it runs. You can set it to run every minute or once every 5 minutes depending on the traffic your website generates.